package cn.legend.travel.admin.authorize.controller;

import cn.legend.travel.admin.authorize.service.IBackendApiService;
import cn.legend.travel.common.web.JsonResult;
import com.baomidou.mybatisplus.extension.api.ApiController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@Api(tags = "权限(api)管理模块")
@RestController
@Validated
@RequestMapping("apis")
@RequiredArgsConstructor
public class BackendApiController extends ApiController {
    private final IBackendApiService backendApiService;

    @GetMapping("list")
    @ApiOperation("获取权限列表")
    @PreAuthorize("hasAuthority('/apis/getAll')")
    public JsonResult getList() {
        return JsonResult.ok(backendApiService.getList());
    }

}
